package cn.amebius.avoice.mapper;

import cn.amebius.avoice.pojo.users.Student;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

/**
 * @author 阿伟
 * {@code @Date} 2022/10/14 20:23
 */


public interface StudentMapper {

    /**
     * 获取学生数据通过学号
     * @param studentNumber 学号
     * @return 学生对象
     */
    @Select("select * from tab_user_student where student_number = #{studentNumber}")
    Student getStudentByStudentNumber(String studentNumber);

    /**
     * 添加学生用户
     * @param student 学生对象
     * @return 是否成功
     */
    @Insert("insert into tab_user_student value(null,#{studentNumber},#{password},null,#{clazz},#{gander},0,null,0,0,#{tel},#{email})")
    boolean insertStudent(Student student);

    /**
     * 找回密码
     * @param studentNumber 学号
     * @param password 密码
     * @return 是否成功
     */
    @Update("update tab_user_student set password = #{password} where student_number = #{studenNumber}")
    boolean updateStudentPasswordByStudentNumber(String studentNumber,String password);
}
